print("<[100]> evalsupport module start")

# 类装饰器一般不返回新的类,只是修改了类的方法
def deco_alpha(cls):
    print("<[200]> deco_alpha")

    def inner_1(self):
        print("<[300]> deco_alpha:inner_1", cls)
        print("旧的类被替换", self.__class__ != cls, self.__class__)
        if isinstance(self, int):
            print("!int!")

    cls.method_y = inner_1
    # NOTE 篡改类
    ## FIXME argument 3 must be dict, not mappingproxy,TODO 使用 dict包裹
    return type("FuckedClass", (cls,), dict(cls.__dict__))


class MetaAleph(type):
    print("<[400]> MetaAleph body")

    # 构造__new__=> 类的工厂,成功创建之后的init 钩子
    def __init__(cls, name, bases, dic):
        print("<[500]> MetaAleph.__init__", cls, name, bases, dic)

        def inner_2(self):
            print("<[600]> MetaAleph.__init__:inner_2")
            print("self is", self)
            print("cls is", cls)
            print("self.__class__", self.__class__)

        cls.method_z = inner_2


print("<[700]> evalsupport module end")
print("<[{}]>".format(__name__))
